<?php include $this->admin_tpl('meta', 'admin');?>
<title>员工列表</title>
</head>
<body>
<div class="page-container">
  <div> 
    <form action="<?php echo U('money_list');?>" method="get" id="search">
	 <input type="hidden" value="<?php echo ROUTE_M;?>" name="m">
	 <input type="hidden" value="<?php echo ROUTE_C;?>" name="c">
     <span class="select-box inline">
		<select name="department_id" class="select">
			<option value="">请选择部门</option>
			<?php echo $select_menus;?>
		</select>
	</span>
    <span class="select-box inline">
		<select name="is_housing" class="select">
			<option value="">是否有房补</option>
			<option value="1" <?php if($is_housing=='1'){?> selected <?php }?>>有</option>
			<option value="0" <?php if($is_housing=='0'){?> selected <?php }?>>无</option>
		</select>
	</span>
    <span class="select-box inline">
		<select name="is_meal" class="select">
			<option value="">是否有餐补</option>
			<option value="1" <?php if($is_meal=='1'){?> selected <?php }?>>有</option>
			<option value="0" <?php if($is_meal=='0'){?> selected <?php }?>>无</option>
		</select>
	</span>
    <span class="select-box inline">
		<select name="is_action" class="select">
			<option value="">是否生效</option>
			<option value="1" <?php if($is_action=='1'){?> selected <?php }?>>生效中</option>
			<option value="2" <?php if($is_action=='2'){?> selected <?php }?>>待生效</option>
			<option value="0" <?php if($is_action=='0'){?> selected <?php }?>>已失效</option>
		</select>
	</span>
    <span class="select-box inline">
		<select name="is_ss" class="select">
			<option value="">是否购买社保</option>
			<option value="1" <?php if($is_ss=='1'){?> selected <?php }?>>生效中</option>
			<option value="0" <?php if($is_ss=='0'){?> selected <?php }?>>已失效</option>
		</select>
	</span>
     <input type="text" name="name"  placeholder="请输入姓名" class="input-text" style="width:170px" value="<?php if(isset($_GET['name'])) echo $_GET['name'];?>">
	 <button name="dosubmit" class="btn btn-success radius" type="submit" value="1"><i class="yzm-iconfont yzm-iconsousuo"></i> 搜索</button>
	 <a class="btn btn-primary radius" href="<?php echo U('money_list');?>"><i class="yzm-iconfont yzm-iconshuaxin"></i> 清空</a>
	 </form>	
  </div>
  <div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l">
  <a href="javascript:;" onclick="yzm_open('添加明细','<?php echo U('money_add');?>','800','600')" class="btn btn-success radius"><i class="yzm-iconfont yzm-icontianjia"> 添加明细</i></a>
  
  
  
  <a href="javascript:;" onclick="yzm_dels('ids')" class="btn btn-danger radius"><i class="yzm-iconfont yzm-iconshanchu2"> 批量删除</i></a>
  </span> <span class="r">共有数据：<strong><?php echo $total?></strong> 条</span> </div>
  <form method="post" action="<?php echo U('money_delete');?>" id="myform">
  <table class="table table-border table-bordered table-bg table-hover yzm-table-sort">
    <thead>
      <tr class="text-c">
        <th width="25"><input type="checkbox"></th>
		<th width="40">ID<?php echo field_order('ml.id');?></th>
		<th width="80">姓名</th>
		<th width="150">部门<?php echo field_order('m.department_id');?></th>
		<th width="75">岗位</th>
		<th width="75">薪资<?php echo field_order('ml.money');?></th>
		<th width="75">房补</th>
		<th width="50">餐补</th>
		<th width="60">社保</th>
		<th width="70">双轨制<?php echo field_order('ml.is_second');?></th>
		<th>备注</th>
		<th width="80">状态<?php echo field_order('ml.is_action');?></th>
		<th width="80">生效时间<?php echo field_order('ml.action_time');?></th>
		<th width="120">添加时间<?php echo field_order('ml.add_time');?></th>
		<th width="120">操作</th>
      </tr>
    </thead>
    <tbody>
		<?php 
		foreach($data as $val){
		?>
		  <tr class="text-c">
			<td><input type="checkbox" value="<?php echo $val['id']?>" name="ids[]"></td>
			<td><?php echo $val['id']?></td>
			<td><a title="查看员工信息" href="javascript:;" member_id="<?php echo $val['member_id'];?>" style="text-decoration:none" class="c-primary btn_member_info"><?php echo $val['name'];?></a></td>
			<td class="text-l"><?php if($val['department_id']){echo department($val['department_id']);}?></td>
			<td><?php if(isset(position($val['position_id'])['name'])){echo position($val['position_id'])['name'];}?></td>
			<td>
				<span class="f-l">****</span>
				<span class="f-l" style="display:none;"><?php echo $val['money'];?></span>
				<span class="f-r" onclick="look(this);">
					<a href="javascript:;" class="btn btn-default radius" style="height:25px;width:30px;text-align:center;font-size:18px;line-height:22px;padding:0;">
						<i class="yzm-iconfont yzm-iconpreview"></i>
					</a>
				</span>
			</td>
			<td>
				<span class="f-l">****</span>
				<span class="f-l" style="display:none;"><?php echo $val['housing_money'];?></span>
				<span class="f-r" onclick="look(this);">
					<a href="javascript:;" class="btn btn-default radius" style="height:25px;width:30px;text-align:center;font-size:18px;line-height:22px;padding:0;">
						<i class="yzm-iconfont yzm-iconpreview"></i>
					</a>
				</span>
			</td>
			<td>
				<?php echo $val['meal_money'] ? $val['meal_money'] : '无';?>
			</td>
			<td>
				<?php if($val['is_ss']){ ?>
				<span class="yzm-status-enable"><i class="yzm-iconfont">&#xe81f;</i>已购买</span>
				<?php }else{ ?>
				<span class="yzm-status-disable"><i class="yzm-iconfont">&#xe601;</i>未购买</span>
				<?php } ?>
			</td>
			<td>
				<?php if($val['is_second']){ ?>
				<span class="yzm-status-enable"><i class="yzm-iconfont">&#xe81f;</i>双轨制</span>
				<?php }else{ ?>
				<span class="yzm-status-disable"><i class="yzm-iconfont">&#xe601;</i>标准制</span>
				<?php } ?>
			</td>
			<td class="text-l">
			<?php echo $val['remark'] ? $val['remark'] : '-';?>
			</td>
			<td>
				<?php if($val['is_action']==1){ ?>
				<span class="yzm-status-enable"><i class="yzm-iconfont">&#xe81f;</i>生效中</span>
				<?php }elseif($val['is_action']==2){ ?>
				<span class="" style="color:#f37b1d;"><i style="font-size:14px;" class="Hui-iconfont">&#xe6e0;</i>待生效</span>
				<?php }else{ ?>
				<span class="yzm-status-disable"><i class="yzm-iconfont">&#xe601;</i>归档</span>
				<?php } ?>
			</td>
			<td>
				<?php echo date('Y-m-d',$val['action_time']);?>
			</td>
			<td>
				<?php echo date('Y-m-d H:i:s',$val['add_time']);?>
			</td>
			<td>
				<a title="编辑明细" href="javascript:;" onclick="yzm_open('编辑明细','<?php echo U('money_add',array('id'=>$val['id']));?>',800,600)" style="text-decoration:none" class="btn-mini btn-primary ml-5">编辑</a>
			</td>
		  </tr>		
		<?php 
		}
		?>
    </tbody>
  </table>
  <?php if(!$data){ ?><div class="yzm_no_data"><i class="Hui-iconfont">&#xe6e0;</i> 暂无数据</div><?php } ?>
  </form>
  <div id="page"><span class="page_left">共<?php echo $total?>条记录，共<?php echo $page->total()?>页，当前显示第<?php echo $page->getpage()?>页</span>
  <span class="page_right"><?php echo $page->getfull();?></span></div>
</div>
<?php include $this->admin_tpl('footer', 'admin');?>
<script type="text/javascript" src="<?php echo STATIC_URL;?>plugin/laydate/1.1/laydate.js"></script>
<script type="text/javascript">

$('.btn_member_info').on('click',function(){
	let member_id = $(this).attr('member_id');
	let url = '<?php echo U('hr_member/member_info')?>'+'?id='+member_id;
	let width = '800px';
	if(screen.width<800){
		width = '100%';
	}
	layer.open({  
		type: 2,  
		title: '查看员工信息',  
		shadeClose: true,  
		shade: 0.2,  
		area: [width, '700px'],  
		content: url,
		success: function(layero, index){
			
		}
	})
	return false;
})
function open_bank(obj){
	layer.open({
	  title: '查看银行卡信息',
	  content: $(obj).attr('data')
	});     
}

	function look(obj){
		if($(obj).find('a').eq(0).hasClass('btn-default')){
			$(obj).find('a').removeClass('btn-default');
			$(obj).find('a').addClass('btn-success');
			$(obj).prev().show();
			$(obj).prev().prev().hide();
		}else{
			$(obj).find('a').addClass('btn-default');
			$(obj).find('a').removeClass('btn-success');
			$(obj).prev().prev().show();
			$(obj).prev().hide();
		}
	}

	function lock(){
		if ($("input[name='ids[]']:checked").length<1){
		   layer.alert('请勾选信息！');
		   return false;
		}	
		document.getElementById('myform').action='<?php echo U('lock')?>';
		document.getElementById('myform').submit();
	}

	function unlock(){
		if ($("input[name='ids[]']:checked").length<1){
		   layer.alert('请勾选信息！');
		   return false;
		}	
		document.getElementById('myform').action='<?php echo U('unlock')?>';
		document.getElementById('myform').submit();
	}


	var start = {elem:'#start',format:'YYYY-MM-DD hh:mm:ss',min:'1999-01-01',max:'2099-01-01',istime:true,istoday:false,choose:function(datas){end.min = datas;end.start = datas}
	};
	var end = {elem:'#end',format:'YYYY-MM-DD hh:mm:ss',min:'1999-01-01',max:'2099-01-01',istime:true,istoday:false,choose:function(datas){start.max = datas;}};
	laydate(start);
	laydate(end);
</script>

</body>
</html>